<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div {
      width: 200px;
      height: 200px;
      padding: 20px;
      border: 20px solid #333;
      margin: 20px;

      background-color: skyblue;
      background-clip: content-box;

      box-sizing: border-box;

      /* display: none; */
      visibility: hidden;
      float: left;
    }
  </style>
</head>
<body>

  <div style="" class="">
  </div>

  <script>
      var ele = document.querySelector('div');

      console.log('offsetWidth',ele.offsetWidth);
      console.log('offsetHeight',ele.offsetHeight);
    // 边框+内边距+内容  


      console.log('clientWidth',ele.clientWidth);
      console.log('clientHeight',ele.clientHeight);
      //内边距 内容 

      // client 获取的是不包含边框的 
  </script>
</body>
</html>
